import {UIComponent} from "../../AzraelFrameWork/RunTime/UI/UIComponent";

const {ccclass, property} = cc._decorator;
import {BaseComponent} from "../../AzraelFrameWork/RunTime/Base/BaseComponent";
import {ResourceComponent} from "../../AzraelFrameWork/RunTime/Resource/ResourceComponent";
import { GameEntry } from "../../AzraelFrameWork/RunTime/Base/GameEntry";
import {ProcedureComponent} from "../../AzraelFrameWork/RunTime/Procedure/ProcedureComponent";
import {SettingComponent} from "../../AzraelFrameWork/RunTime/Setting/SettingComponent";
import EventComponent from "../../AzraelFrameWork/RunTime/Event/EventComponent";
import {FsmComponent} from "../../AzraelFrameWork/RunTime/Fsm/FsmComponent";

@ccclass
export default class GameMainEntry extends cc.Component{
    static get Fsm(): FsmComponent {
        return this._Fsm;
    }

    static set Fsm(value: FsmComponent) {
        this._Fsm = value;
    }
    static get Event(): EventComponent {
        return this._Event;
    }

    static set Event(value: EventComponent) {
        this._Event = value;
    }
    static get Setting(): SettingComponent {
        return this._Setting;
    }

    static set Setting(value: SettingComponent) {
        this._Setting = value;
    }
    static get Procedure(): ProcedureComponent {
        return this._Procedure;
    }

    static set Procedure(value: ProcedureComponent) {
        this._Procedure = value;
    }
    static get UI(): UIComponent {
        return this._UI;
    }

    static set UI(value: UIComponent) {
        this._UI = value;
    }
    static get Resource(): ResourceComponent {
        return this._Resource;
    }

    static set Resource(value: ResourceComponent) {
        this._Resource = value;
    }
    static get Base(): BaseComponent {
        return this._Base;
    }

    static set Base(value: BaseComponent) {
        this._Base = value;
    }

    private static _Base:BaseComponent;
    private static _Resource:ResourceComponent;
    private static _UI:UIComponent;
    private static _Procedure:ProcedureComponent;
    private static _Setting:SettingComponent;
    private static _Event:EventComponent;
    private static _Fsm:FsmComponent;

    public static InitBuiltinComponents():void{
        this._Base = GameEntry.getComponment(BaseComponent);
        this._Event = GameEntry.getComponment(EventComponent);
        this._Fsm = GameEntry.getComponment(FsmComponent);
        this._Resource = GameEntry.getComponment(ResourceComponent);
        this._Procedure = GameEntry.getComponment(ProcedureComponent);
        this._Setting = GameEntry.getComponment(SettingComponent);
        this._UI = GameEntry.getComponment(UIComponent);

    }

    protected  onLoad(): void {

    }

    protected start(): void {
        cc.game.addPersistRootNode(this.node);
        GameMainEntry.InitBuiltinComponents();
    }


}